import unittest
import requests
from ddt import ddt, unpack,data
from Day_2211A.Unit_04.excel import excel
path = r'C:\Users\86155\PycharmProjects\untitled\Day_2211A\Unit_04\login.xlsx'
sheetname = 'login'
dy = excel(path, sheetname)

@ddt
class movie(unittest.TestCase):
    host = 'http://10.59.9.18'
    # 登录
    userId = None
    sessionId = None
    @data(*dy.getdatafromexcel())
    @unpack
    def test_movie_login_01(self, caseid, case_qz, case_title, case_b_v1, case_b_v2, case_exp):
        url = movie.host + '/movieApi/user/v2/login'
        print(caseid+case_qz)
        print(case_title)
        json = {"email": case_b_v1, "pwd": case_b_v2}
        login = requests.post(url=url, data=json)
        print(login.json())
        print(case_exp)

    # 查询区域列表
    regionId = None
    def test_movie_regionId_02(self):
        url = movie.host + '/movieApi/tool/v2/findRegionList'
        regionId = requests.get(url=url)
        print(regionId.json())
        movie.regionId = regionId.json()['result'][0]['regionId']
        print(movie.regionId)



if __name__ == '__main__':
    unittest.main()